package com.example.switchinactivitiesanimation.fragments.views;


import com.example.switchinactivitiesanimation.R;
import com.example.switchinactivitiesanimation.FadeInFadeOutActivity;

import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

public class MainActivityFragment extends Fragment {

	public MainActivityFragment() {

	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {

		View rootView = inflater.inflate(R.layout.fragment_main, container,
				false);
		
		ViewComponents(rootView);

		return rootView;
	}
	
	public void ViewComponents(View rootView){
		buttonAction(rootView);
	}
	
	public void buttonAction(View rootView){
		
		Button nextAct = (Button)rootView.findViewById(R.id.nextAct);
		nextAct.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				Toast.makeText(v.getContext(), "Fade in Fade out activity", Toast.LENGTH_SHORT).show();
				Intent intent = new Intent(v.getContext(), FadeInFadeOutActivity.class);	
				getActivity().startActivity(intent);		
				getActivity().overridePendingTransition(R.animator.push_up_in, R.animator.push_up_out);
			}
			
		});		
		
	}
		
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
	}
	
	@Override
	public void onStart() {
		super.onStart();
	}

	@Override
	public void onResume() {
		super.onResume();
	}

	@Override
	public void onPause() {
		super.onPause();
	}

	@Override
	public void onStop() {
		super.onStop();
	}

	@Override
	public void onDestroyView() {
		super.onDestroyView();
	}
	
	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	@Override
	public void onDetach() {
		super.onDetach();
	}
}
